package com.nuoniu.sibanyun.service.expenses;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nuoniu.sibanyun.entity.crm.CrmGoodsOrder;
import com.nuoniu.sibanyun.entity.expenses.ExpensesBusinessOrder;
import com.nuoniu.sibanyun.entity.expenses.dto.ExpensesBusinessOrderSearchDto;

import java.util.List;

/**
 * <p>
 * 费用中心-业务订单 服务类
 * </p>
 *
 * @author 小啊刚
 * @since 2022-05-06
 */
public interface IExpensesBusinessOrderService extends IService<ExpensesBusinessOrder> {
    /**
     * 分页查询 订单
     * @param businessOrderSearchDto
     * @return
     */
    Page<ExpensesBusinessOrder> pageList(ExpensesBusinessOrderSearchDto businessOrderSearchDto);

    /**
     * 分页查询 订单（系统）
     * @param businessOrderSearchDto
     * @return
     */
    Page<ExpensesBusinessOrder> sysPageList(ExpensesBusinessOrderSearchDto businessOrderSearchDto);

    /**
     * 新增业务订单
     * @param expensesBusinessOrder
     */
    void addBusinessOrder(ExpensesBusinessOrder expensesBusinessOrder);

    /**
     * 校验 业务订单 数量
     * @param expensesBusinessOrder
     * @return
     */
    int checkBusinessOrder(ExpensesBusinessOrder expensesBusinessOrder);

    /**
     * 按条件 最新一条记录
     * @param expensesBusinessOrder
     * @return
     */
    ExpensesBusinessOrder getLastExpensesBusinessOrder(ExpensesBusinessOrder expensesBusinessOrder);
    /**
     * 批量废弃 没有交易成功的 业务订单
     * @param expensesBusinessOrder
     * @return
     */
    boolean batchAbandon(ExpensesBusinessOrder expensesBusinessOrder);
    /**
     * 坐席订单 交易成功
     * @param ids 坐席ID
     * @param orderId 订单ID
     */
    void dealAgentOrder(List<Long> ids, Integer orderId);

    /**
     * 生成基础产品订单
     * @param crmGoodsOrder
     */
    void saveFromCrmGoodsOrder(CrmGoodsOrder crmGoodsOrder);

    /**
     * 根据基础商品订单查询 业务订单
     * @param crmGoodsOrderNo
     * @return
     */
    ExpensesBusinessOrder getByCrmGoodsOrderNo(String crmGoodsOrderNo);

    /**
     * 通过ID查询订单详情
     * @param orderId
     * @return
     */
    ExpensesBusinessOrder getByCrmGoodsOrderId(Long orderId);


}
